<?php
namespace App\HttpController;

use App\Lib\Redis\Redis;
use EasySwoole\Core\Component\Di;

class Index extends Base
{

    public function test(){


        //$person = new Person();
        //$person->select();

        //$result = Db::table('person')->select();


        //
        $db = Di::getInstance()->get('MYSQL');
        $persons = $db->get("db_person");


        $this->writeJson(200, $persons, '请求成功');
    }


    public function testRedis(){
        //$redis = new \Redis();
        //$redis->connect('139.9.119.67', 10004, 5);
        //$redis->auth('123456');

        //方式1
        //$name = Redis::getInstance()->get('name');

        //方式2
        $name = Di::getInstance()->get('REDIS')->get('name');

        $this->writeJson(200, $name, 'Ok');

    }


    public function testRedisQueue(){
        echo Di::getInstance()->get('REDIS')->get('name');
        Di::getInstance()->get('REDIS')->rPush('list_test', 'hello');
    }



}